﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DBManager.ProductUserDAL
{
    public class CommentUDAL
    {
        public static int AddCommentUDAL(string Type , string ObjectID , string Name , string Email , string acc , string Content , string ParentID , string Reply, string Status, string ObjectTitle)
        {
            //them cong ty
            int kq = 0;
            try
            {
                string sql = @"INSERT INTO Comments 
           (Type
           ,ObjectID
           ,Name
           ,Email
           ,acc
           ,Content
           ,ParentID
           ,Reply
           ,Dateadded
           ,Status
           ,ObjectTitle)
            VALUES 
           ("+comm.to_sqltext(Type)+@"
           ," + comm.to_sqlnumber(ObjectID) + @"
           ," + comm.to_sqltext(Name) + @"
           ," + comm.to_sqltext(Email) + @"
           ," + comm.to_sqltext(acc) + @"
           ," + comm.to_sqltext(Content) + @"
           ," + comm.to_sqltext(ParentID) + @"
           ," + comm.to_sqltext(Reply) + @"
           ,GETDATE()
           ," + comm.to_sqlnumber(Status) + @"
           ," + comm.to_sqltext(ObjectTitle) + @")";
                DBUtil.Execute(sql);
                kq = 1;
            }
            catch (Exception)
            {
                kq = 0;
            }
            return kq;
        }
    }
}
